<template>
<el-dialog title="撤销档案借出" :visible.sync="visible" width="500px" append-to-body :close-on-click-modal="false">
  <p>请确认撤销以下档案借出?</p>
  <el-descriptions :column="1" size="small" border>
    <el-descriptions-item label="案卷号">{{ borrowData.fileCode }}</el-descriptions-item>
    <el-descriptions-item label="题名">{{ borrowData.title }}</el-descriptions-item>
    <el-descriptions-item label="借出人">{{ borrowData.userName }}</el-descriptions-item>
  </el-descriptions>
  <div slot="footer" class="dialog-footer">
    <el-button type="primary" @click="submit">确 定</el-button>
    <el-button @click="cancel">取 消</el-button>
  </div>
</el-dialog>
</template>

<script>
import {repealAmBorrow} from "../../../api/am/amBorrow";

export default {
  data() {
    return {
      title: '',
      visible: false,
      formTemp: {
        timeRange: []
      },
      form: {
        archiveId: '',
        type: '',
        borrowTime: '',
        returnTime: '',
        reason: '',
        remark: '',
        days: 0,
      },
      rules: {},
      borrowData: {}
    }
  },
  methods: {
    handleRangeChange() {
      this.form.borrowTime = this.formTemp.timeRange[0];
      this.form.returnTime = this.formTemp.timeRange[1];
    },
    open(borrowData) {
      this.borrowData = borrowData
      this.visible = true
    },
    submit() {
      repealAmBorrow(this.borrowData.id).then(response => {
        this.$modal.msgSuccess('借阅撤销成功，您可以再次编辑信息。');
        this.$emit('success');
        this.cancel()
      })
    },
    cancel() {
      this.visible = false
    },
  }
}
</script>

<style lang="scss"></style>
